package com.hellpro.lolbox.mine.view;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.hellpro.lolbox.R;
import com.hellpro.lolbox.base.LolBaseActivity;
import com.hellpro.lolbox.mine.presenter.VerificationPresenter;
import com.hellpro.lolbox.utils.UIManger;

import butterknife.BindView;
import butterknife.OnClick;

public class SmsVerificationActivity extends LolBaseActivity implements IMineVerificationActivity {

    @BindView(R.id.main_register_iv_return)
    ImageView mainRegisterIvReturn;
    @BindView(R.id.mine_smsVerification_smsState)
    TextView mineSmsVerificationSmsState;
    @BindView(R.id.mine_smsVerification_et_smsCode)
    EditText mineSmsVerificationEtSmsCode;
    @BindView(R.id.mine_smsVerification_et_password)
    EditText mineSmsVerificationEtPassword;
    @BindView(R.id.mine_smsVerification_tvShow)
    TextView mineSmsVerificationTvShow;
    @BindView(R.id.mine_smsVerification_btn_register)
    Button mineSmsVerificationBtnRegister;
    private VerificationPresenter presenter;
    private String phoneNo;

    @Override
    public int getLayoutId() {
        return R.layout.activity_sms_verification;
    }

    @Override
    public void initView() {
        Intent intent = getIntent();
        phoneNo = intent.getStringExtra("phoneNo");
        mineSmsVerificationSmsState.setText("信息已发送至" + phoneNo);

        presenter = new VerificationPresenter(this);
    }

    @Override
    public EditText getEtSmsMode() {
        return mineSmsVerificationEtSmsCode;
    }

    @Override
    public EditText getEtPassword() {
        return mineSmsVerificationEtPassword;
    }

    @Override
    public String getPhoneNo() {

        return phoneNo;
    }

    @Override
    public Context getVerificationContext() {
        return SmsVerificationActivity.this;
    }

    @Override
    public TextView getTvShow() {
        return mineSmsVerificationSmsState;
    }


    @OnClick({R.id.mine_smsVerification_tvShow, R.id.mine_smsVerification_btn_register})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.mine_smsVerification_btn_register:
                presenter.setSmsCodeState();
                final String password = mineSmsVerificationEtPassword.getText().toString();
                UIManger.startToUserInfoActivity(this, UserInfoActivity.class, phoneNo, password);
                finish();
                break;
        }
    }
}
